 /**
 * @file tal_time_sync.h
 * @brief Common process - time synchronization 
 * @version 1.0.0
 * @date 2021-10-08
 *
 * @copyright Copyright 2018-2021 Tuya Inc. All Rights Reserved.
 *
 */
#ifndef __TAL_TIME_SYNC_H__
#define __TAL_TIME_SYNC_H__


#ifdef __cplusplus
    extern "C" {
#endif

#include "tuya_cloud_types.h"
#include "tuya_zigbee_stack.h"


/**
 * @brief time synchronization struct
 */
typedef struct {
    UINT_T sync_period; ///< time synchronization period
} TAL_TIME_SYNC_T;



/**
 * @brief time synchronization start
 * 
 * @param[in]   none
 *
 * @return none
 */
VOID_T tal_time_sync_start(VOID_T);

/**
 * @brief get current time
 * 
 * @param[in]   none
 *
 * @return current time
 */
TIME_T tal_current_time_get(VOID_T);

/**
 * @brief time synchronization is complete
 * 
 * @param[in]   none
 *
 * @return TRUE: time sync complete
 */
BOOL_T tal_time_sync_is_complete(VOID_T);

/**
 * @brief time synchronization period setting
 * 
 * @param[in]   time_ms: period (bat: ms)
 *
 * @return none
 */
VOID_T tal_time_sync_period_set(UINT_T time_ms);

/**
 * @brief time synchronization complete callback
 * @note < this is a weak function you can rewrite this API in app layer >
 * 
 * @param[in]   status:   status after time synchronization with gateway
 * @param[in]   time_sec: time (bat: sec)
 *
 * @return none
 */
VOID_T tal_time_sync_complete_callback(BOOL_T status, UINT_T time_sec);


#ifdef __cplusplus
}
#endif

#endif

